package com.CampusLife.service.impl;

import com.CampusLife.bean.Product;
import  com.CampusLife.bean.User;
import  com.CampusLife.dao.IUserDao;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import  com.CampusLife.service.IUerService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Administrator
 */
@Service

@Transactional
public class UserServiceImpl implements IUerService {

    @Resource
    private IUserDao userDao;

    @Override
    public List<User> queryAll() {
        return userDao.queryAll();
    }

    @Override
    public User queryById(Integer id) {
        return userDao.queryById(id);
    }

    @Override
    public void add(User user) {
        userDao.add(user);
    }

    @Override
    public int update(User id) {

        return this.userDao.update(id);

    }

    @Override
    public void delete(Integer id) {
        userDao.delete(id);
    }

    @Override
    public  User login(String username,String password){
        return userDao.login(username,password);}

        @Override
    public  void UpdatePassword(User user ){
        userDao.UpdatePassword(user);
        }

    @Override
    public void addUserName(User user) {
        userDao.addUserName(user);
    }

    @Override
    public User ByUsername(String username, String password) {

        return null;
    }

    @Override
    public List<User> ByUsername(String username) {
        List<User> users= userDao.ByUsername(username);
        return users;
    }

    @Override
    public List<User> ByNikeName(String nickname) {
        List<User> users=userDao.ByNikeName(nickname);
        return users;
    }
    @Override
    public void updatePasswordAdmin(User user) {

           userDao.updatePasswordAdmin(user);
    }

    @Override
    public User getPhone(String username) {
        User user=userDao.getPhone(username);
        return user;
    }

    @Override
    public void updatePassword(User user) {
        userDao.UpdatePassword(user);
    }

    @Override
    public Integer selectByUserName(String username) {
        return userDao.selectByUserName(username);
    }
}



